<!--
PAGE DOCUMENTATION:
==================
This page includes general definitions and inclueds that are generaly necessary.
This is where the user is forced to log in (to facebook & the application), if he isn't already.
-->

<?php

require_once 'facebook-platform/client/facebook.php';
require_once 'server.php';

define("ERROR_PAGE_URL","/error.php",1);


$facebook = new Facebook($appapikey, $appsecret);
$user = $facebook->require_login();

$appcallbackurl = $server;

try {
  if (!$facebook->api_client->users_isAppAdded()) {
    $facebook->redirect($facebook->get_add_url());
  }
} catch (Exception $ex) {
  //this will clear cookies and redirect them to a login prompt
  $facebook->set_user(null, null);
  $facebook->redirect($appcallbackurl);
}






?>